<template>
  <!-- oce column.overHidden 默认值修改为true  -->
  <el-table-column
    :prop="columnOption.prop"
    :label="columnOption.label"
    filter-placement="bottom-end"
    v-if="getColumnProp(columnOption, 'hide')"
    :filters="getColumnProp(columnOption, 'filters')"
    :filter-method="
      getColumnProp(columnOption, 'filterMethod')
        ? handleFiltersMethod
        : undefined
    "
    :filter-multiple="vaildData(columnOption.filterMultiple, true)"
    :show-overflow-tooltip="vaildData(columnOption.overHidden, true)"
    :min-width="columnOption.minWidth"
    :sortable="getColumnProp(columnOption, 'sortable')"
    :render-header="columnOption.renderHeader"
    :align="columnOption.align || crud.tableOption.align"
    :header-align="columnOption.headerAlign || crud.tableOption.headerAlign"
    :width="getColumnProp(columnOption, 'width')"
    :fixed="getColumnProp(columnOption, 'fixed')"
  >
    <template v-for="column in columnOption.children">
      <column-dynamic
        v-if="column.children && column.children.length > 0"
        :key="column.label"
        :columnOption="column"
      >
        <template v-for="item in crud.mainSlot" slot-scope="scope" :slot="item">
          <slot v-bind="scope" :name="item"></slot>
        </template>
      </column-dynamic>
      <column-slot
        v-else
        :column="column"
        :column-option="columnOption.children"
      >
        <template v-for="item in crud.mainSlot" slot-scope="scope" :slot="item">
          <slot v-bind="scope" :name="item"></slot>
        </template>
      </column-slot>
    </template>
  </el-table-column>
</template>

<script>
import { Crud } from '../../../../assets/avue/avue'

export default {
  name: 'column-dynamic',
  extends: Crud.components.column.components.columnDynamic,
}
</script>
